#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2018/12/2 12:23
# @Author  : lizhen
# @Site    : 
# @File    : extract__words.py
# @Software: PyCharm
import re


class Words:
    def __init__(self):
        pass

    def get_pattern_first(self, pattern, desc_str, index=0):
        _result = re.findall(pattern, desc_str)
        return _result[index]


def main():
    w = Words()
    print(w.get_pattern_first('\d{4}-\d{2}-\d{2}', '发表于:2018-11-21   浏览数:10485'))


if __name__ == '__main__':
    main()
